class AddDefaultRolesAndUsers < ActiveRecord::Migration
  def self.up
    Role.new(:name => 'Administrator').save
    Role.new(:name => 'Moderator').save
    User.new(:login => 'tecnobrat', :email => 'admin@tecnobrat.com', :password => 'tecnobrat', :password_confirmation => 'tecnobrat', :roles => [Role.find_by_name('Administrator')]).save
    User.new(:login => 'brian', :email => 'brian@tecnobrat.com', :password => 'brian', :password_confirmation => 'brian').save
    User.find_by_login('tecnobrat').update_attributes(:activation_code => '', :activated_at => Time.now)
    User.find_by_login('brian').update_attributes(:activation_code => '', :activated_at => Time.now)
  end

  def self.down
    User.find_by_login('tecnobrat').destroy
    User.find_by_login('brian').destroy
    Role.find_by_name('Administrator').destroy
    Role.find_by_name('Moderator').destroy
  end
end
